package com.zkyc.framework.common.utils;

import org.apache.commons.lang3.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

public class WebsiteUtil {
    //获取请求头中的websiteId
    public static String getWebsiteId(){
        ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        String websiteId = sra.getRequest().getHeader("websiteId");
        return websiteId;
    }
    //获取请求头中的userId
    public static String getUserId(){
        ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        String userId = sra.getRequest().getHeader("userId");
        return userId;
    }
    //获取accessToken
    public static boolean hasAccessToken(){
        ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        return StringUtils.isNotBlank(sra.getRequest().getHeader("accessToken"));
    }

}
